home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / POV-Ray 3.0.2 / src / SOURCE / BLOB.H < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-30  |  5.0 KB  |  147 lines  |  [TEXT/CWIE]

  1. /****************************************************************************
  2. *                   blob.h
  3. *
  4. *  This module contains all defines, typedefs, and prototypes for BLOB.C.
  5. *
  6. *  from Persistence of Vision(tm) Ray Tracer
  7. *  Copyright 1996 Persistence of Vision Team
  8. *---------------------------------------------------------------------------
  9. *  NOTICE: This source code file is provided so that users may experiment
  10. *  with enhancements to POV-Ray and to port the software to platforms other
  11. *  than those supported by the POV-Ray Team.  There are strict rules under
  12. *  which you are permitted to use this file.  The rules are in the file
  13. *  named POVLEGAL.DOC which should be distributed with this file. If
  14. *  POVLEGAL.DOC is not available or for more info please contact the POV-Ray
  15. *  Team Coordinator by leaving a message in CompuServe's Graphics Developer's
  16. *  Forum.  The latest version of POV-Ray may be found there as well.
  17. *
  18. * This program is based on the popular DKB raytracer version 2.12.
  19. * DKBTrace was originally written by David K. Buck.
  20. * DKBTrace Ver 2.0-2.12 were written by David K. Buck & Aaron A. Collins.
  21. *
  22. *****************************************************************************/
  23.  
  24.  
  25. #ifndef BLOB_H
  26. #define BLOB_H
  27.  
  28. #include "bsphere.h"
  29.  
  30.  
  31.  
  32. /*****************************************************************************
  33. * Global preprocessor defines
  34. ******************************************************************************/
  35.  
  36. #define BLOB_OBJECT (STURM_OK_OBJECT+HIERARCHY_OK_OBJECT)
  37.  
  38. /* Do not use the first bit!!! (Used for enter/exit in intersection test) */
  39.  
  40. #define BLOB_SPHERE               2
  41. #define BLOB_CYLINDER             4
  42. #define BLOB_ELLIPSOID            8
  43. #define BLOB_BASE_HEMISPHERE     16
  44. #define BLOB_APEX_HEMISPHERE     32
  45. #define BLOB_BASE_HEMIELLIPSOID  64
  46. #define BLOB_APEX_HEMIELLIPSOID 128
  47.  
  48.  
  49. /* Define max. number of blob components. */
  50.  
  51. #define MAX_BLOB_COMPONENTS 1000000
  52.  
  53. /* Generate additional blob statistics. */
  54.  
  55. #define BLOB_EXTRA_STATS 1
  56.  
  57.  
  58.  
  59. /*****************************************************************************
  60. * Global typedefs
  61. ******************************************************************************/
  62.  
  63. typedef struct Blob_Struct BLOB;
  64. typedef struct Blob_Element_Struct BLOB_ELEMENT;
  65. typedef struct Blob_Data_Struct BLOB_DATA;
  66. typedef struct Blob_List_Struct BLOB_LIST;
  67. typedef struct Blob_Interval_Struct BLOB_INTERVAL;
  68.  
  69. struct Blob_Element_Struct
  70. {
  71.   short Type;       /* Type of component: sphere, hemisphere, cylinder */
  72.   int index;
  73.   VECTOR O;         /* Element's origin                                */
  74.   DBL len;          /* Cylinder's length                               */
  75.   DBL rad2;         /* Sphere's/Cylinder's radius^2                    */
  76.   DBL c[3];         /* Component's coeffs                              */
  77.   DBL f[5];         /* Component's final coeffs                        */
  78.   TEXTURE *Texture; /* Component's texture                             */
  79.   TRANSFORM *Trans; /* Component's transformation                      */
  80. };
  81.  
  82. struct Blob_Data_Struct
  83. {
  84.   int References;           /* Number of references     */
  85.   int Number_Of_Components; /* Number of components     */
  86.   DBL Threshold;            /* Blob threshold           */
  87.   BLOB_ELEMENT *Entry;      /* Array of blob components */
  88.   BLOB_INTERVAL* Intervals; /* Intervals used during intersection testing */
  89.   BSPHERE_TREE *Tree;       /* Bounding hierarchy       */
  90. };
  91.  
  92. struct Blob_Struct
  93. {
  94.   OBJECT_FIELDS
  95.   TRANSFORM *Trans;
  96.   BLOB_DATA *Data;    /* Pointer to blob data  */
  97.   TEXTURE **Element_Texture;
  98. };
  99.  
  100. struct Blob_List_Struct
  101. {
  102.   BLOB_ELEMENT elem;  /* Current element          */
  103.   BLOB_LIST *next;    /* Pointer to next element  */
  104. };
  105.  
  106. struct Blob_Interval_Struct
  107. {
  108.   int type;
  109.   DBL bound;
  110.   BLOB_ELEMENT *Element;
  111. };
  112.  
  113.  
  114.  
  115. /*****************************************************************************
  116. * Global variables
  117. ******************************************************************************/
  118.  
  119. extern METHODS Blob_Methods;
  120.  
  121.  
  122.  
  123. /*****************************************************************************
  124. * Global functions
  125. ******************************************************************************/
  126.  
  127. void Set_Blob_Solver PARAMS((OBJECT *obj, int Sturm_Flag));
  128. void Init_Blob_Queue PARAMS((void));
  129. void BlobDelete PARAMS((OBJECT *obj));
  130. BLOB *Create_Blob PARAMS((void));
  131. void Make_Blob PARAMS((BLOB *blob, DBL threshold, BLOB_LIST *bloblist, int npoints));
  132. BLOB_LIST *Create_Blob_List_Element PARAMS((void));
  133. void Create_Blob_Element_Texture_List PARAMS((BLOB *Blob, BLOB_LIST *BlobList, int npoints));
  134. void Determine_Blob_Textures PARAMS((BLOB *Blob, VECTOR P, int *Count, TEXTURE **Textures, DBL *Weights));
  135. void Test_Blob_Opacity PARAMS((BLOB *Blob));
  136.  
  137. void Translate_Blob_Element PARAMS((BLOB_ELEMENT *Element, VECTOR Vector));
  138. void Rotate_Blob_Element PARAMS((BLOB_ELEMENT *Element, VECTOR Vector));
  139. void Scale_Blob_Element PARAMS((BLOB_ELEMENT *Element, VECTOR Vector));
  140. void Invert_Blob_Element PARAMS((BLOB_ELEMENT *Element));
  141. void Transform_Blob_Element PARAMS((BLOB_ELEMENT *Element, TRANSFORM *Trans));
  142. void Destroy_Blob_Queue PARAMS((void));
  143.  
  144.  
  145.  
  146. #endif
  147.